<template>
  <div>
    <h2>侦听器</h2>
    <input type="text" v-model="uname">
  </div>
</template>

<script>
export default {
  data () {
    return {
      uname: 'zs',
      dog: {
        name: '旺财',
        age: 3
      }
    }
  },
  watch: {
    uname: {
      handler (val) {
        console.log(val)
      },
      immediate: true, 
    },
   
    'dog.name' (val) {
      console.log(val)
    }
  }
}
</script>

<style>

</style>